import unittest
import paramunittest

from com.hanamaki.study.db.util import JDBCUtils
from com.hanamaki.study.unittest.paramter.ddt import FileUtils


def dp_sql():
    return JDBCUtils.get_sql_content('login', 'user_name', 'pass_word')


def dp_file():
    return FileUtils.read_text('data.txt')


def dp_excel():
    return FileUtils.read_excel('dataContent.xls')


@paramunittest.parametrized(

    # 字典
    # {'username': 'hanamaki', 'password': '123456'},
    # {'username': 'andy', 'password': '123456'},
    # {'username': 'jojo', 'password': '123456'},
    # {'username': 'jack', 'password': '123456'},

    # 通过 读取数据库 访问数据
    # dp_sql()[0],
    # dp_sql()[1],
    # dp_sql()[2],

    # ('hanamaki', '123456'),
    # ('andy', '123456'),
    # ('jojo', '123456'),
    # ('jack', '123456'),
    # ('rose', '123456'),
    # ('yutou', '123456'),

    # 读取文件中的数据
    # dp_file()[0],
    # dp_file()[1],
    # dp_file()[2],

    # 读取 excel中的数据
    dp_excel()[0],
    dp_excel()[1],

)
class TestBar(unittest.TestCase):
    def setParameters(self, username, password):
        self.username = username
        self.password = password

    def testLess(self):
        print(self.username)
        print(self.password)


if __name__ == '__main__':
    unittest.main()
